<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="security"
	uri="http://www.springframework.org/security/tags"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@page import="java.io.FileOutputStream"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.io.File"%>
<%@page import="java.io.OutputStream"%>
<html>
<head>
<title>Muzycy.pl - serwis informacyjno usługowy o muzykach</title>
<META HTTP-EQUIV="Content-Type"
	CONTENT="text/html; charset=windows-1250">
<link href="css/styles.css" rel="stylesheet" type="text/css">
</head>

<div id="body">
	<div id="menu">
	<div class="logged">
		Zalogowany jako: <b><security:authentication
						property="principal.username" /></b>
		</div>
		<ul>
			<li>
			<a href="uzytkownicy.htm" class="active"><img src="images/butt_users.jpg" alt="" width="160" height="67" />	</a>
			</li>
			<li>
			<a href="adminnews.htm"><img src="images/butt_news.jpg"	alt="" width="100" height="67" /></a>
			</li>
			<li>
			<a href="comments.htm"><img src="images/butt_comments.jpg" alt="" width="160" height="67" /></a>
			</li>
			<li>
			<a href="mojekonto.htm"><img src="images/butt_logout.jpg" alt="" width="125" height="67" /></a>
			</li>			
		</ul>
		<div class="slogan">
			<img src="images/slogan_listnews.jpg" alt="" width="594" height="144" />
		</div>
	</div>
	<div id="overview">
		
		<div id="box">

				<h1>
					Edycja newsa:
					<c:out value="${news.title }" />
				</h1>

				<form:form action="adminupdatenews.htm?news_id=${news.id }"
					commandName="news">
					<br />
					
						<h3>Tytuł :</h3>
						<form:input path="title" />
						<br /><span style="color: red"><c:out
									value="${titleError}" /> </span>
					
					<br />
						<h3>Treść newsa :</h3>
						<form:textarea rows="5" cols="50" path="news" />
						<br /><span style="color: red"><c:out
									value="${newsError}" /> </span>
					<br />
					<br />
					<h3>Tagi:</h3>
					
						<select name="tags" multiple="multiple">
								<c:forEach items="${tagList}" var="tag">
									<c:forEach items="${news.tags}" var="current">
										<c:if test="${current.id == tag.id}">
											<c:set var="selected" value="true" />
										</c:if>
									</c:forEach>
									<option value="${tag.id}"
										<c:if test="${selected}">selected="selected"</c:if>>
										${tag.name}</option>
									<c:remove var="selected" />
								</c:forEach>
						</select>
						
					<br />
					<br />	<input type="submit" class="myButton2" value="Zmień">
						
				</form:form>


			</div>

		<div id="footer" style="margin-left:0px">
			<div id="copyright">
				Copyright Czesiu. All rights reserved. Design by <a
					href="http://nyan.cat">NyanCat</a>
			</div>
		</div>
	</div>
</div>
</html>